package flyGin

import (
	"github.com/gin-gonic/gin"
	"gofly/models"
	"html/template"
	"log"
)

var err error

func NewFlyGin() {
	g := gin.Default()
	err = models.MysqlConnect()
	//err = models.SqlLiteConnect()
	if err != nil {
		log.Println(err)
	}
	templ := template.Must(template.New("all").ParseGlob("templates/*.html"))
	g.SetHTMLTemplate(templ)
	//g.LoadHTMLGlob("templates/*")

	InitApiRouter(g)
	g.Run("0.0.0.0:8081")
}
